import java.util.Iterator;
import java.util.TreeSet;

public class LearnTreeSet {
    public static void main(String[] args) {
        //树型很好的解决了增删改查的不方便
        TreeSet<User> user = new TreeSet<>();

        user.add(new User("Learn1",25));
        user.add(new User("Learn2",26));
        user.add(new User("Learn3",27));
        user.clear();

        Iterator iterator = user.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }

    }
}
